package cn.dnui_jzy913.dnuifood_16110100913.model;

import android.telecom.Call;

import java.util.List;

import cn.dnui_jzy913.dnuifood_16110100913.bean.CommentsBean;
import cn.dnui_jzy913.dnuifood_16110100913.bean.FoodBean;
import cn.dnui_jzy913.dnuifood_16110100913.bean.FoodInfoBean;
import cn.dnui_jzy913.dnuifood_16110100913.bean.Result;
import cn.dnui_jzy913.dnuifood_16110100913.bean.isCollected;
import cn.dnui_jzy913.dnuifood_16110100913.common.Constants;
import cn.dnui_jzy913.dnuifood_16110100913.iface.FoodIface;
import cn.dnui_jzy913.dnuifood_16110100913.listener.RetrofitListener;
import cn.dnui_jzy913.dnuifood_16110100913.service.FoodService;

public class FoodModel extends BaseModel implements FoodIface {
    private FoodService foodService;
    public FoodModel(){
        this.foodService = retrofit.create(FoodService.class);
    }
    @Override
    public void getFoodByShop(String shop_id, RetrofitListener listener) {
        retrofit2.Call<List<FoodBean>> call = foodService.getFoodByShop(shop_id);
        bindCallback(call,listener,Constants.GETFOODBYSHOP);
    }

    @Override
    public void isCollected(String user_id, String shop_food_id, String flag, RetrofitListener listener) {
        retrofit2.Call<isCollected> call = foodService.isCollected(user_id,shop_food_id,flag);
        bindCallback(call,listener,Constants.ISCOLLECTED);
    }

    @Override
    public void userCollectShop(String user_id, String shop_id, RetrofitListener listener) {
        retrofit2.Call<Result> call = foodService.userCollectShop(user_id,shop_id);
        bindCallback(call,listener,Constants.USERCOLLECTSHOP);
    }

    @Override
    public void getAllCommentsByFood(String food_id, RetrofitListener listener) {
        retrofit2.Call<List<CommentsBean>> call = foodService.getAllCommentsByFood(food_id);
        bindCallback(call,listener,Constants.GETALLCOMMENTSBYFOOD);
    }

    @Override
    public void getFoodById(String food_id, RetrofitListener listener) {
        retrofit2.Call<FoodInfoBean> call = foodService.getFoodById(food_id);
        bindCallback(call,listener,Constants.GETFOODBYID);
    }


}
